import { BizConfigUtils } from '@/common/biz-config-utils'

export class WorkTicketModel {
  constructor (
    public key?: string,
    public id?: string,
    // 单位名称
    public unitName?: string,
    // 工作票编号
    public workTicketCode?: string,
    // 班组名称
    public teamName?: string,
    public teamId?: string,
    // 工作负责人
    public workLeader?: string,
    // 工作班人员
    public shiftStaff?: string,
    // 工作班人数
    public totalNumber?: string,
    // 工作场所名称
    public workspace?: string,
    // 工作地点及设备名称
    public dutyStation?: string,
    public formWorkTicketTypeCode?: string,
    public deviceId?: string,
    // 工作内容
    public jobContent?: string,
    // 电气安全措施
    public safetyMeasures?: string,
    //
    public planWorkStartTime?: string,
    //
    public planWorkEndTime?: string,
    // 计划工作开始年
    public planWorkStartYear?: string,
    // 计划工作开始月
    public planWorkStartMonth?: string,
    // 计划工作开始日期
    public planWorkStartDate?: string,
    // 计划工作开始小时
    public planWorkStartHour?: string,
    // 计划工作开始分
    public planWorkStartMinute?: string,
    // 计划工作结束年
    public planWorkEndYear?: string,
    // 计划工作结束月
    public planWorkEndMonth?: string,
    // 计划工作结束日期
    public planWorkEndDate?: string,
    // 计划工作结束小时
    public planWorkEndHour?: string,
    // 计划工作结束分
    public planWorkEndMinute?: string,
    // 创建时间
    public createTime?: string,
    // 创建用户
    public createUserId?: string,
    public createUserName?: string
  ) {
    this.id = id
  }
}

function formStateValue () {
  const date = new Date()
  const year = date.getFullYear() + ''
  const month:string = (date.getMonth() > 8 ? (date.getMonth() + 1) + '' : '0' + (date.getMonth() + 1) + '') as string
  console.log('month:', month)
  console.log('month:', typeof month)
  const day = date.getDate() > 8 ? (date.getDate() + 1) + '' : '0' + (date.getDate() + 1) + ''
  const teamName = BizConfigUtils.getLoginUser().teamName
  const data = {
    unitName: '国网朝阳供电公司信息通信分公司（数据中心）',
    workTicketCode: `朝阳-${teamName}-${year}${month}-0001`,
    teamName: teamName,
    workLeader: '',
    shiftStaff: '',
    totalNumber: '',
    workspace: '',
    dutyStation: '',
    jobContent: '',
    safetyMeasures: '',
    planWorkStartTime: '',
    planWorkEndTime: '',
    planWorkStartYear: year,
    planWorkStartMonth: month,
    planWorkStartDate: day,
    planWorkStartHour: '08',
    planWorkStartMinute: '30',
    planWorkEndYear: year,
    planWorkEndMonth: month,
    planWorkEndDate: day,
    planWorkEndHour: '17',
    planWorkEndMinute: '00'
  }
  console.log('formStateValue:--data-', data)
  console.log('formStateValue:-data--', data)
  return data
}
export { formStateValue }
